package com.hxz.admin.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.hxz.entity.Article;

@Mapper
public interface AdminArticleModifyMapper {

	@Select("SELECT id,title,viewnum,date,content,top,add_name,category FROM article  ORDER BY date DESC")
	List<Article> getArticleList();

	@Select("SELECT id,title,viewnum,date,content,top,add_name,category FROM article WHERE id= #{id}")
	Article getContents(String id);

	@Update("UPDATE article SET title=#{title},date=#{date},content=#{content},top=#{top},add_name=#{add_name},category=#{category} WHERE id =#{id}")
	Integer updateArticle(Article article);

	@Delete("DELETE FROM article where id = #{id}")
	Integer deleteArticleById(Integer id);
}
